select C.matricule,libressource1,libressource2,mat.codcompet,comp.libcompet,comp.codcla,datdeb,datfin 
from rcressource C inner join gcmatcom mat on C.matricule = mat.matricule 
inner join gccompet comp on mat.codcompet = comp.codcompet 
where C.matricule = '01400' and datfin >= '12/11/13';

select rcressource.matricule, max(datent), rcressource.libressource1, rcressource.libressource2, po.libposte from rcmouvnt 
INNER JOIN rcressource ON rcmouvnt.matricule = rcressource.matricule 
INNER JOIN postpla pla ON rcressource.matricule = pla.matricule 
INNER JOIN poste po ON pla.codposte = po.codposte 
where datout > '04/11/13' 
AND (rcressource.matricule = '01404' OR rcressource.matricule = '02100') 
group by rcressource.matricule, rcressource.libressource1, rcressource.libressource2, po.libposte;

select * from rcvalzon where matricule = '01824';
select rcressource.matricule, max(datent), rcressource.libressource1, rcressource.libressource2, from rcmouvnt INNER JOIN rcressource ON rcmouvnt.matricule = rcressource.matricule INNER JOIN postpla pla ON rcressource.matricule = pla.matricule INNER JOIN poste po ON pla.codposte = po.codposte where datout > '12/11/13' AND (rcressource.matricule = '01824') group by rcressource.matricule, rcressource.libressource1, rcressource.libressource2, po.libposte;

select rcressource.matricule, rcressource.libressource1, rcressource.libressource2
from rcmouvnt 
INNER JOIN rcressource ON rcmouvnt.matricule = rcressource.matricule 
where datout > '12/11/13' AND (rcressource.matricule = '02050') 
group by rcressource.matricule, rcressource.libressource1, rcressource.libressource2;


SELECT *
                                  FROM gcmatcom mat 
                                  INNER JOIN gccompet comp on mat.codcompet = comp.codcompet
                                  WHERE codcla = 'PISTES' and matricule = '02050'
                                  ORDER BY codcla;

SELECT *
         FROM rcressource A
         INNER JOIN rcvalzon B on A.matricule = B.matricule
         INNER JOIN rclisval C on B.valeur = C.codval
         WHERE A.matricule = '00141';

SELECT libval FROM rcressource A 
INNER JOIN rcvalzon B on A.matricule = B.matricule 
INNER JOIN rclisval C on B.valeur = C.codval 
WHERE B.zone_id = '2011062939712258372217971' 
ORDER BY A.libressource1;

SELECT A.matricule, libval FROM rcressource A INNER JOIN rcvalzon B on A.matricule = B.matricule INNER JOIN rclisval C on B.valeur = C.codval 
WHERE C.codval = '044'  ORDER BY A.libressource1;

SELECT  a.matricule, a.libressource1, a.libressource2, datdeb, datfin, libval  FROM rcressource A INNER JOIN rcvalzon B on A.matricule = B.matricule INNER JOIN rclisval C on B.valeur = C.codval 
WHERE B.zone_id = '2011062939712258372217971' AND A.matricule = '01404' 
ORDER BY datfin desc;

SELECT * FROM rcressource A INNER JOIN rcvalzon B on A.matricule = B.matricule INNER JOIN rclisval C on B.valeur = C.codval WHERE B.zone_id = '2011062939712258372217971' AND A.matricule = '01404' order by B.DATFIN DESC;

select A.matricule, max(datout), A.libressource1, A.libressource2, libval from rcmouvnt INNER JOIN rcressource A ON rcmouvnt.matricule = A.matricule INNER JOIN rcvalzon B on A.matricule = B.matricule INNER JOIN rclisval C on B.valeur = C.codval WHERE B.zone_id = '2011062939712252057754020' and datout > '13/11/13' and c.codval = '010' group by A.matricule, A.libressource1, A.libressource2, libval order by A.libressource1, A.libressource2;

select A.matricule, max(datfin), A.libressource1, A.libressource2, libval from rcmouvnt INNER JOIN rcressource A ON rcmouvnt.matricule = A.matricule INNER JOIN rcvalzon B on A.matricule = B.matricule INNER JOIN rclisval C on B.valeur = C.codval WHERE datfin > '13/11/13' and c.codval = '040' and datout > '13/11/13' group by A.matricule, A.libressource1, A.libressource2, libval order by A.libressource1, A.libressource2;

select * from rcvalzon where matricule = '01404' and zone_id = '2011062939712252057754020';
select * from rcmouvnt  where matricule = '02509';

select A.matricule, max(datfin), A.libressource1, A.libressource2 from rcmouvnt INNER JOIN rcressource A ON rcmouvnt.matricule = A.matricule INNER JOIN rcvalzon B on A.matricule = B.matricule INNER JOIN rclisval C on B.valeur = C.codval WHERE datout > '13/11/13' and datfin > '13/11/13' group by A.matricule, A.libressource1, A.libressource2 order by A.libressource1, A.libressource2;

select A.matricule, max(datfin), A.libressource1, A.libressource2 from rcmouvnt INNER JOIN rcressource A ON rcmouvnt.matricule = A.matricule INNER JOIN rcvalzon B on A.matricule = B.matricule INNER JOIN rclisval C on B.valeur = C.codval WHERE datout > '13/11/13' and datfin > '13/11/13' group by A.matricule, A.libressource1, A.libressource2 order by A.libressource1, A.libressource2;